const fs = require('fs');
const path = require('path');

// SVG图标内容
const svgContent = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  <rect x="20" y="15" width="60" height="70" rx="5" fill="#3b82f6"/>
  <rect x="25" y="20" width="50" height="60" rx="3" fill="#ffffff"/>
  <line x1="30" y1="30" x2="70" y2="30" stroke="#3b82f6" stroke-width="2"/>
  <line x1="30" y1="40" x2="70" y2="40" stroke="#3b82f6" stroke-width="2"/>
  <line x1="30" y1="50" x2="70" y2="50" stroke="#3b82f6" stroke-width="2"/>
  <line x1="30" y1="60" x2="70" y2="60" stroke="#3b82f6" stroke-width="2"/>
  <polygon points="65,25 75,35 70,40 60,30" fill="#10b981"/>
</svg>
`;

// 创建public目录如果不存在
const publicDir = path.join(__dirname, 'public');
if (!fs.existsSync(publicDir)) {
  fs.mkdirSync(publicDir);
}

// 将SVG内容写入文件
const svgFilePath = path.join(publicDir, 'favicon.svg');
fs.writeFileSync(svgFilePath, svgContent.trim());

console.log('SVG favicon created at:', svgFilePath);
console.log('To convert this to ICO format, you can use an online converter or tools like ImageMagick:');
console.log('1. Visit https://convertio.co/svg-ico/ or similar site');
console.log('2. Upload the favicon.svg file');
console.log('3. Convert to ICO format');
console.log('4. Download and place the favicon.ico file in the public directory');